﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.Web
{
    public static class SsCtlUtil
    {
        public static void Picker(Page page, string code, System.Web.UI.HtmlControls.HtmlAnchor link, TextBox ctlDisplay, HiddenField ctlValue)
        {
            link.HRef = "javascript:void();";
            string url = string.Format("{0}?code={1}", page.ResolveClientUrl("~/_common/Picker.aspx"), code);
            string scriptString = string.Format("function fn_{0}_picker(){1}_ss.picker('{2}','{3}','{4}');{5}", link.ClientID, "{", url, ctlDisplay.ClientID, ctlValue.ClientID, "}");
            page.ClientScript.RegisterClientScriptBlock(typeof(Page), string.Format("fn_{0}_picker", link.ClientID), scriptString, true);
            link.Attributes.Add("onclick", string.Format("fn_{0}_picker();", link.ClientID));
        }
    }
}
